package com.linkgap.cloud.service;

import com.linkgap.cloud.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SchoolService {


    @Autowired
    private TeacherService teacherService;

    @Autowired
    private ClazzService clazzService;

    @Autowired
    private StudentService studentService;


    /**
     * 查询老师赵磊所教的班级，有哪些学生
     *
     * @param teacherName 老师名称
     * @return 学生的列表
     */
    public List<Student> queryStudentList(String teacherName) {

        //1.查询老师表，返回老师的id
        Long teacherId = teacherService.queryTeacherIdByTeacherName(teacherName);
        //2.传入老师id,查询班级表，返回班级的id列
        List<Long> clazzIdList = clazzService.queryClazzIdByTeacherId(teacherId);
        //3.传入班级的id列表，查询学生表，返回学生的集合
        List<Student> studentList = studentService.queryStudentListByClazzIdList(clazzIdList);


        return null;
    }

}
